package inc.gome.dynamic.datasource.dynamic;

import com.google.common.collect.Lists;
import org.jclouds.ContextBuilder;
import org.jclouds.domain.Credentials;
import org.jclouds.rest.internal.BaseHttpApiMetadata;

/**
 * @author sujizhou
 * @Date 2021/12/2
 * @Desc 类描述信息
 */
public class MainDemo {
    public static void main(String[] args) {

        /**
         *   .endPoint("http://10.115.5.199:8080/")
         *             .credentials("admin:123.gome")
         */
        Credentials admin = new Credentials("admin", "123.gome");
        JenkinsApi jenkinsApi = ContextBuilder
                //jenkins 元数据
                .newBuilder(new JenkinsApiMetadataCustomize.Builder().build())
                .endpoint("http://localhost:8084/")
                .modules(Lists.newArrayList(new AuthenticationModule(admin)))
                .overrides(BaseHttpApiMetadata.defaultProperties())
                .buildApi(JenkinsApi.class);


//        PipelineNode pipelineNode = jenkinsApi.jobsApi().pipelineNode( "test_jenkinsfile", 15, 15);
        JobsApi jobsApi = jenkinsApi.jobsApi();

        for (int i = 0; i <10 ; i++) {
            new Thread(()->{
                String purchase = jobsApi.purchase();
                System.out.println(purchase);
            }).start();

        }

        System.out.println("pipelineNode");
    }
}
